﻿/*
* @Author： whg
* @Date : 2021-1-19
* @Desc : 
*/
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using XNode;
public class MainRoleNode : BaseNode 
{
    [Input(backingValue = ShowBackingValue.Always)]
    public BaseNode upLink;
    [Output(backingValue = ShowBackingValue.Always)]
    public BaseNode downLink;
    public override StringBuilder ToTable()
    {
        StringBuilder result = new StringBuilder(1024);
        string space = "				";
        result.Append(space + "{\n					type = Config.StoryConst." + mainRoleType + ",\n");
        space += "	";
        switch (mainRoleType)
        {
            case MainRoleType.MainRoleMove:
                result.Append(space + "last = " + move_last.ToString().ToLower() + ",\n");
                result.Append(space + "mode = " + moveType + ",\n");
                result.Append(space + "target = {x=" + move_target.x +",y="+move_target.y+ "},\n");
                break;
            case MainRoleType.MainRoleRotate:
                result.Append(space + "mode = " + moveType + ",\n");
                result.Append(space + "angle = " + rotate_angle + ",\n");
                break;
            case MainRoleType.MainRolePlay:
                result.Append(space + "time = " + play_time + ",\n");
                result.Append(space + "content = " + play_content + ",\n");
                result.Append(space + "head_use = " + play_head_use + ",\n");
                result.Append(space + "recover = " + play_recover + ",\n");
                break;
            case MainRoleType.MainRoleRide:
                result.Append(space + "bool = " + ride_bool.ToString().ToLower() + ",\n");
                 result.Append(space + "time = " + ride_time + ",\n");
                 result.Append(space + "ins_id = " + ride_ins_id + ",\n");
                 result.Append(space + "bone = " + ride_bone + ",\n");
                 result.Append(space + "anim = " + ride_anim + ",\n");
                break;
            case MainRoleType.MainRoleJumpRide:
                result.Append(space + "bool = " + jumpRide_bool.ToString().ToLower() + ",\n");
                result.Append(space + "time = " + jumpRide_time + ",\n");
                result.Append(space + "ins_id = " + jumpRide_ins_id + ",\n");
                result.Append(space + "anim = " + jumpRide_anim + ",\n");
                result.Append(space + "peak = {center=" + jumpRide_peak.x + ",h=" + jumpRide_peak.y + "},\n");
                break;
            case MainRoleType.MainRoleShadow:
                result.Append(space + "bool = " + shadow_bool.ToString().ToLower() + ",\n");
                result.Append(space + "target = {x=" + shadow_target.x + ",y=" + shadow_target.y + ",z=" + shadow_target .z+ "},\n");
                break;
            case MainRoleType.MainRoleMatrix:
                result.Append(space + "x=" + matrix.x + ",y=" + matrix.y + ",z=" + matrix.z +",w="+matrix.w+ ",\n");
                break;
        }
        result.Append("				},");
        return result;
    }
    public enum MainRoleType { MainRoleMove, MainRoleRotate, MainRolePlay, MainRoleRide, MainRoleJumpRide, MainRoleShadow, MainRoleMatrix }
    public MainRoleType mainRoleType = MainRoleType.MainRoleMove;

    #region MainRoleMove
    public enum MoveType { 寻路像素坐标 = 0, 瞬移像素坐标, 攀爬 }
    [Tooltip("是否需要剧情结束再执行（针对1类型特殊处理）")]
    public MoveType moveType = MoveType.寻路像素坐标;
    [Tooltip("0 寻路(像素坐标); 1 瞬移（像素坐标）; 2 攀爬")]
    public bool move_last = true;
    [Tooltip("目标位置,像素坐标")]
    public Vector2 move_target;
    #endregion

    #region MainRoleRotate
    public enum RotateType { 直接设置 = 0, 逐渐过渡 }
    [Tooltip("0直接设置  1逐渐过渡")]
    public RotateType rotateType = RotateType.直接设置;
      [Tooltip("目标角度")]
    public int rotate_angle;
    #endregion

    #region MainRolePlay
    [Tooltip("动画持续时长，单位s")]
    public float play_time = 3;
    [Tooltip("动画名字")]
    public string play_content = "rein";
     [Tooltip("头部播放动画")]
    public bool play_head_use = true;
     [Tooltip("播放玩动作之后是否复位（针对带位移的动画）")]
    public bool play_recover = false;
    #endregion

    #region MainRoleRide
     [Tooltip("true为上， false为下")]
     public bool ride_bool = true;
        [Tooltip("上坐骑时长，单位s")]
     public float ride_time = 3;
        [Tooltip("目标坐骑的实例id")]
     public string ride_ins_id = "huaxiangyi";
        [Tooltip("节点")]
     public string ride_bone = "ride";
        [Tooltip("上坐骑的动画名")]
     public string ride_anim = "huaxiangyi";

    #endregion

    #region MainRoleJumpRide
        [Tooltip("true为上， false为下")]
    public bool jumpRide_bool = true;
        [Tooltip("上坐骑时长，单位s")]
    public float jumpRide_time = 0.8f;
        [Tooltip("目标坐骑的实例id")]
    public string jumpRide_ins_id = "301007";
        [Tooltip("上坐骑的动画名")]
    public string jumpRide_anim = "riseup";
        [Tooltip("高点配置")]
    public Vector2 jumpRide_peak;

    #endregion

    #region MainRoleShadow
    [Tooltip("是否显示阴影")]
    public bool shadow_bool = true;
    [Tooltip("目标位置，3D坐标")]
    public Vector3 shadow_target = new Vector3(-2.78f, 15.88f, 9.91f);

    #endregion

    #region MainRoleMatrix
      [Tooltip("阴影矩阵")]
    public Vector4 matrix;
    #endregion
}
